package com.five.admin.controller;

import com.five.admin.service.SystemAdviceService;
import com.five.controller.BaseController;
import com.five.entity.SystemAdvice;
import com.five.vo.BaseResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("systemAdvice")
@Api(tags = "通知消息接口")
@CrossOrigin
public class SystemAdviceController extends BaseController {
    @Autowired
    private SystemAdviceService systemAdviceService;
    @ResponseBody
    @RequestMapping(value = "addAdvice",method = RequestMethod.POST)
    @ApiOperation("发送通知给指定对象")
    public BaseResultVO addAdvice(SystemAdvice systemAdvice,@RequestParam(value = "idList") List<String> idList){

        systemAdviceService.addAdvice(systemAdvice,idList);
        return successRespWithMessage("发送成功");
    }
    @ResponseBody
    @RequestMapping(value = "addAdviceToAll",method = RequestMethod.POST)
    @ApiOperation("发送全局通知")
    public BaseResultVO addAdviceToAll(SystemAdvice systemAdvice){

        systemAdviceService.addAdviceToAll(systemAdvice);
        return successRespWithMessage("发送成功");
    }
}
